
import time

print(time.time())
time.sleep(2)  # 让程序停止2秒
print(time.time())
print(time.ctime())  # 返回时间的字符串
t1 = time.localtime()  #
print(t1)
print(f'当前时间：{t1.tm_year}年{t1.tm_mon}月{t1.tm_mday}日 ')
# 计算5天前的本地时间
cur_time = time.time()  # 获取当前时间的时间戳
day5_before = cur_time - 60*60*24*5
t2 = time.localtime(day5_before)
print('t2:', t2)